<?php
/*Problem Domain
To test the List of Sessions class of the TMS
*/

include_once '../TrainingSession.php';
include_once '../ListOfSessions.php';

class TestListOfSessions extends PHPUnit_Framework_TestCase
{
	public function testLostOfSessionsObject()
	{
		$sess1 = new TrainingSession("phpsession", "ketul", date("2015-02-08 11:14:15.638276"), TrainingSession::AVALIABLE);
		$sess2 = new TrainingSession("webuisession", "piyush", new DateTime("2015-01-01 10:00:00"), TrainingSession::NOTAVALIABLE);

		$los1 = new ListOfSessions('week1_sessions' , array($sess1));

		$this->assertEquals('week1_sessions' , $los1->getSessionListName());
		$this->assertEquals(1 , count($los1->getListOfSessions()));
	
		$los1->addToList($sess2);

		$this->assertEquals(2 , count($los1->getListOfSessions()));

		$los1->removeFromList($sess1);
		$this->assertEquals(1 , count($los1->getListOfSessions()));
		$sess = $los1->getListOfSessions();

		$this->assertEquals('webuisession' , $sess[0]->getSessionName());		
	}
}
?>
